package tool

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

const (
	SUCCESS int = 1 // 0 表示失败 1 表示成功
	FAILED  int = 0 // 0 表示失败 1 表示成功
)

func Success(ctx *gin.Context, v interface{}) {
	ctx.JSON(http.StatusOK, map[string]interface{}{
		"data":    v,
		"code":    SUCCESS,
		"message": "Success",
	})
}

func Failed(ctx *gin.Context, v interface{}) {
	ctx.JSON(http.StatusOK, map[string]interface{}{
		"code":    FAILED,
		"message": v,
	})
}
